﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SiyinPractice.Application.ProjectManagement.ProjectManage.Help
{
    /// <summary>
    /// 计时周期类
    /// </summary>
    public class TimeCycle
    {
        /// <summary>
        /// 唯一标识
        /// </summary>
        public Guid ID { get; set; }
        ///// <summary>
        ///// 开始时间(误差1秒=取决于计时器默认时间间隔)
        ///// </summary>
        //public string BeginTime { get; set; }
        ///// <summary>
        ///// 结束时间
        ///// </summary>
        //public string EndTime { get; set; }
        ///// <summary>
        ///// 最大执行次数
        ///// </summary>
        //public int MaxActionTimes { get; set; }
        /// <summary>
        /// 计时周期内执行的动作(动作会在到达开始时间后的)
        /// </summary>
        public Action Action { get; set; }
        /// <summary>
        /// 动作执行时间间隔（秒）
        /// </summary>
        //public int ActionSeconds { get; set; }
        ///// <summary>
        ///// 方法执行次数
        ///// </summary>
        //internal int ActionExecutionTimes { get; set; }

        //public TimeCycle(Guid id, Action action, int actionSeconds) : this(id, "00:00:00", action, actionSeconds)
        //{
        //}

        //public TimeCycle(Guid id, string beginTime, Action action, int actionSeconds) : this(id, beginTime, action, actionSeconds, 0)
        //{
        //}

        //public TimeCycle(Guid id, string beginTime, Action action, int actionSeconds, int maxActionTimes) : this(id, beginTime, "23:59:59", action, actionSeconds, maxActionTimes)
        //{
        //}

        /// <summary>
        /// 基本构造器
        /// </summary>
        /// <param name="id">唯一标识</param>
        /// <param name="beginTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="action">要执行的任务</param>
        /// <param name="actionSeconds">任务执行时间间隔</param>
        /// <param name="maxActionTimes">最大执行次数</param>
        public TimeCycle(Guid id, Action action)
        {
            ID = id;
            //BeginTime = beginTime;
            //EndTime = endTime;
            Action = action;
            //ActionSeconds = actionSeconds;
            //MaxActionTimes = maxActionTimes;
        }
    }
}
